package alogrithm.solution;

/*
 * 绗�9棰橈細
棰樼洰锛氬畾涔塅ibonacci鏁板垪濡備笅锛�  
  / 0 n=0
f(n)= 1 n=1
  \ f(n-1)+f(n-2) n=2

杈撳叆n锛岀敤鏈�揩鐨勬柟娉曟眰璇ユ暟鍒楃殑绗琻椤广�
鍒嗘瀽锛氬湪寰堝C璇█鏁欑涔︿腑璁插埌閫掑綊鍑芥暟鐨勬椂鍊欙紝閮戒細鐢‵ibonacci浣滀负渚嬪瓙銆�鍥犳寰堝绋嬪簭鍛樺杩欓亾棰樼殑閫掑綊瑙ｆ硶闈炲父鐔熸倝锛屼絾....鍛靛懙锛屼綘鐭ラ亾鐨勩�
 */
public class P19 {
	//灏鹃�褰�	
	public static int getFibonacci(int n,int a,int b)
	{
		if(n==1)return a;
		return getFibonacci(n-1, b, a+b);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println(getFibonacci(10, 1, 1));

	}

}
